<!DOCTYPE>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/assets/view/base/tag.jsp" %>
<html>
<head>
    <title>mrcode</title>
    <jsp:include page="/assets/view/common/head-meta.jsp"/>
    <jsp:include page="/assets/view/common/head-ui.jsp"/>
    <%-- <link rel="stylesheet" href="/assets/lib/bootstrap/css/bootstrap.css">--%>
</head>
<body>
<jsp:include page="/assets/view/common/header.jsp"/>
<div class="container">
    <jsp:include page="../manage/menu.jsp"/>
    <div class="row">
        <div class="col-md-10">
            <form class="form-horizontal" id="setprofileFrom" action="${contextPath}/auth/user/setprofile_submit" method="post">
                <div class="form-group form-group-lg has-feedback">
                    <label for="userName" class="col-sm-2 col-md-2 control-label">昵称</label>

                    <div class="col-sm-10 col-md-10">
                        <input type="text" class="form-control" id="userName" name="name" placeholder="请输入昵称" value="${user.name}"
                               maxlength="12">
                        <span class="glyphicon form-control-feedback" aria-hidden="true"></span>
                    </div>

                </div>
                <div class="form-group form-group-lg has-feedback">
                    <label for="sign" class="col-sm-2 col-md-2 control-label">个性签名</label>

                    <div class="col-sm-10 col-md-10">
                        <textarea class="form-control" rows="3" id="sign" name="sign" maxlength="40">${user.sign}</textarea>
                        <span class="glyphicon form-control-feedback" aria-hidden="true"></span>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <c:if test="${result_msg != null}">
                            <div class="alert alert-success alert-dismissible" role="alert">
                                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
                                        aria-hidden="true">&times;</span></button>
                                    ${result_msg}
                            </div>
                        </c:if>
                        <button type="submit" class="btn btn-mod btn-medium btn-round btn-block">保存</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<jsp:include page="/assets/view/common/footer.jsp"/>
<script src="${contextPath}/assets/lib/jquery.validate.js"></script>
<script src="${contextPath}/assets/js/mangaerComm.js"></script>
<script>
    $().ready(function () {
        $("#setprofile").addClass("active");
        $("#setprofileFrom").validate({
//            debug: true,  //调试
            rules: {
                name: {
                    required: true,
                    maxlength: 12
                },
                sign: {
                    required: true,
                    maxlength: 40
                }
            },
            messages: {
                name: {
                    required: "请输入昵称",
                    maxlength: "昵称最多{0}个字符"
                },
                sign: {
                    required: "请输入个性签名",
                    maxlength: "个性签名最多{0}个字 符"
                }
            },
            errorElement: Comm.Ui.Jq_Validate.errorElement,
            errorClass: Comm.Ui.Jq_Validate.errorClass,
            errorPlacement: function (error, element) {
                Comm.Ui.Jq_Validate.errorPlacement(error, element);
            }, success: function (label) {
                Comm.Ui.Jq_Validate.success(label);
            },
            submitHandler: function (form) {
                form.submit();
            }
        });
    });
</script>
</body>
</html>
